package com.lagou.edu.demo.controller;

import com.lagou.edu.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.LagouSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@LagouController
@LagouRequestMapping("/demo")
//@LagouSecurity({"zhangsan", "lisi"})
public class DemoController {

    @LagouAutowired
    private IDemoService demoService;

    @LagouRequestMapping("/test1")
    public String test1(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.getName(name);
    }

    @LagouRequestMapping("/test2")
    @LagouSecurity("lisi")
    public String test2(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.getName(name);
    }

    @LagouRequestMapping("/test3")
    @LagouSecurity("wangwu")
    public String test3(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.getName(name);
    }
}
